package com.bcq.demo;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.os.Bundle;
import android.view.View;

import androidx.appcompat.app.AppCompatActivity;

import com.watermark.core.utils.UIKit;
import com.watermark.ui.WaterMarkActivity;
import com.watermark.ui.WaterMarkBuilder;
import com.watermark.ui.WaterMarkConfig;

import java.text.SimpleDateFormat;
import java.util.Date;

public class MainActivity extends AppCompatActivity implements View.OnClickListener {
    private final static String TAG = "MainActivity";
    View first;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        first = findViewById(R.id.first);
        first.setOnClickListener(this);
    }

    private final static SimpleDateFormat format = new SimpleDateFormat("MM-dd HH:mm:ss");

    Bitmap bitmap = BitmapFactory.decodeResource(UIKit.getContext().getResources(), com.water_mark.R.mipmap.watermark);

    @Override
    public void onClick(View v) {
        int id = v.getId();
        if (R.id.first == id) {
            WaterMarkConfig config = WaterMarkConfig.of(0, 0, true);
            config.settWartMarkBackgroundColor(14, Color.WHITE, Color.BLUE);
            WaterMarkActivity.sWaterMarkBuilder = new WaterMarkBuilder() {
                @Override
                public String[] onBuild() {
                    return new String[]{format.format(new Date()), "啥情况", "什么鬼","你好","哈哈哈哈哈哈哈哈哈哈哈哈有什么啊是吗"};
//                    return format.format(new Date());
//                    return bitmap;
                }
            };
            WaterMarkActivity.sMaxTime = 30;
            WaterMarkActivity.openWaterMark(MainActivity.this, config, 1000);
        }
    }
}